<template>
  <div class="recommend" v-if="recommendData">
    <div class="decommend-detail">
      <h3>{{title}} ({{recommendData.length}})</h3>
      <div class="user-commend">
        <ul>
          <li v-for="(item,index) in recommendData" :key="index">
            <div class="user-img">
              <img v-lazy="item.user.avatarUrl" alt="">
            </div>
            <div class="user-main">
              <div class="user-spoke">
                <span class="user-name">{{item.user.nickname}}：</span>
                <span class="user-des">{{item.content}}</span>
              </div>
              <!-- 回复评论 -->
              <div class="re-comment" v-if="item.beReplied[0]">
                <span class="name">@{{ item.beReplied[0].user.nickname }} : </span>
                <span class="rec">{{ item.beReplied[0].content }}</span>
              </div>
              <div class="comment-time">
                <span>{{item.time | LocaleDateString}}</span>
                <span><i class="iconfont icon-dianzan"></i>{{item.likedCount}}</span>
              </div>
            </div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'MyRecommend',
  props: {
    title: String,
    recommendData: {
      type: Array,
      default() {
        return []
      }
    }
  }
}
</script>

<style lang="less" scoped>
.recommend {
  .decommend-detail {
    h3 {
      margin: 10px 0;
    }
    .user-commend {
      ul {
        li {
          display: flex;
          margin: 10px 0;
          .user-img {
            width: 100px;
            height: 100px;
            img {
              width: 80px;
              height: 80px;
              border-radius: 50%;
              margin: 10px 10px 0;
            }
          }
          .re-comment {
            background-color: #999;
            padding: 8px 20px;
            .name {
              color: skyblue;
              margin-right: 10px;
              font-size: 14px;
            }
          }
          .user-main {
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            font-size: 14px;
            margin: 10px 0 10px 10px;
            flex: 1;
            .user-spoke {
              .user-name {
                color: skyblue;
              }
            }
            .comment-time {
              display: flex;
              justify-content: space-between;
              color: red;
              span {
                font-size: 12px;
                &:first-child {
                  color: #666;
                }
              }
            }
          }
        }
      }
    }
  }
}
</style>